package com.ibeeking.found.report.rest.controller.v1;

import com.ibeeking.found.report.rest.service.IBaseService;
import com.ibeeking.found.report.rest.service.IReportService;
import com.ibeeking.found.report.service.common.dos.ReportDO;
import com.ibeeking.found.report.service.common.po.ResponseBean;
import com.ibeeking.found.report.service.common.query.ReportPageQuery;
import com.ibeeking.found.report.service.common.vo.ReportVO;
import com.ibeeking.nematos.constants.enums.OperateLogTypeEnum;
import com.ibeeking.nematos.log.annotation.Log;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * TODO
 *
 * @author chenkening
 * @date 2021/3/26 10:19
 */
@RestController
@RequestMapping("/report/v1")
public class DmpReportController extends DmpBaseController<ReportPageQuery, ReportDO, ReportVO> {

    @Resource
    private IReportService reportServiceImpl;

    @Override
    public IBaseService<ReportPageQuery, ReportDO> getService() {
        return reportServiceImpl;
    }

    @Override
    public ReportDO getEntity() {
        return new ReportDO();
    }

    @Override
    public ReportVO getDTO() {
        return new ReportVO();
    }

    @Log(logType = OperateLogTypeEnum.MODIFY, describe = "复制报表")
    @PostMapping("/copy")
    public ResponseBean copy(@RequestBody ReportVO dto) {
        reportServiceImpl.copy(dto);
        return ResponseBean.builder().build();
    }
}
